#!/bin/bash
dos2unix src/*
dos2unix inc/*
dos2unix lib/*
clear
nasm -f elf -o bin/loader.o src/loader.asm
gcc -o bin/kernel.o -c src/kernel.c -Iinc -Wall -Wextra -Werror -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
gcc -o bin/print.o -c src/print.c -Iinc -Wall -Wextra -Werror -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
gcc -o bin/gdt.o -c src/gdt.c -Iinc -Wall -Wextra -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
gcc -o bin/idt.o -c src/idt.c -Iinc -Wall -Wextra -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
gcc -o bin/isrs.o -c src/isrs.c -Iinc -Wall -Wextra -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
gcc -o bin/irq.o -c src/irq.c -Iinc -Wall -Wextra -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
gcc -o bin/timer.o -c src/timer.c -Iinc -Wall -Wextra -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
gcc -o bin/keyboard.o -c src/keyboard.c -Iinc -Wall -Wextra -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
gcc -o bin/mman.o -c src/mman.c -Iinc -Wall -Wextra -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
cd bin
i586-elf-ld -T ../src/linker.ld -o kernel.bin loader.o kernel.o print.o gdt.o idt.o isrs.o irq.o timer.o keyboard.o mman.o
cat stage1 stage2 pad kernel.bin > floppy.img
